import QtQuick 2.15
import Myobj 1.0
Item {
    id: majorInterface
    width: root.width
    height: root.height


    Chuizi {//锤子显示

    }
    Timer {//内部计时器
        id: time1
        interval: 1000;
        triggeredOnStart: true
        repeat: true
        running: true
        property int ii: 0
        property int jj: 0
        onTriggered: {
            //console.log(MyData.myrand())
            ii = MyData.myrand()
            jj = MyData.myrand()
            laoshu1.i = ((laoshu1.i == ii && laoshu1.j == jj) ? ii - 1 : ii) % 3
            laoshu1.j = ((laoshu1.i == ii && laoshu1.j == jj) ? jj - 1 : jj) % 3
        }
    }
    ContentItem {//显示老鼠
        id: laoshu1
        visible: true
    }
    Background {//显示背景
        z: -1
    }




    MouseArea {//全屏的点击事件
        id: mouse
        anchors.fill: parent
        hoverEnabled: true
        propagateComposedEvents: true
        onClicked: {
            if (mouseX > 80 + laoshu1.xx[laoshu1.i] && mouseX < 160 + laoshu1.xx[laoshu1.i] && mouseY > 280 + laoshu1.yy[laoshu1.j] && mouseY < 360 + laoshu1.yy[laoshu1.j]) {
                time1.stop()
                time1.interval -= 1
                time1.start()
            } else {
                time1.interval -= 30
            }
            if (time1.interval <= 0) {
               stack.pop()
               stack.push(com2)
            }
            console.log(time1.interval)
            mouse.accepted = false
        }
    }
}
